#!/usr/bin/python
# encoding: utf-8
class MaximumMidExpiratoryFlow():
    """
    最大呼气中段流量
    http://club.xywy.com/shouce/check/d173.html
    https://jbk.jiankang.com/jiancha/2862/
    http://doctor-network.com/public/littletools/28.html
    """

    def __init__(self):
        """
        评估模型包含吸烟、喝酒、服用药物、家族疾病史、疾病史、生活习惯、bmi、治疗史、症状9种因素
        """
        pass

    def calc(self, data):
        index = float(data['FVC']) / (2 * float(data["MET"]))
        if data['gender'] == "1":
            if 3452 - 1160 <= index <= 3452 + 1160:
                status = "最大呼气中段流量结果正常"
            else:
                status = "最大呼气中段流量结果异常"
        else:
            if 2836 - 946 <= index <= 2836 - 946:
                status = "最大呼气中段流量结果正常"
            else:
                status = "最大呼气中段流量结果异常"
        return {"MMEF": index, "status": status}
